export const isExternal = (path: string) => {
  return /^(https?:|mailto:|tel:)/.test(path);
};

export const validUsername = (str: string) => {
  const valid_map = ["admin", "editor"];
  return valid_map.indexOf(str.trim()) >= 0;
};

// 手机号校验
export const validMobile = (rule: any, mobile: any, callback: any) => {
  if (/^1[3-9]\d{9}$/.test(mobile)) {
    callback();
  } else {
    callback("请输入正确手机号");
  }
};
